<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>时钟</title>
		<style>
		div{
        padding-top: 2px;
		background: rgb(1,1,50);
		width: 40%;
		height: 50%;
		margin: 0 auto;
		}
		h1{
		letter-spacing: 5px;
		font-weight: normal;
		
		}
		h1,h2{
		color: white;
		text-align: center;
		}
		</style>
	</head>
	<body>
		<div>
			<h1>超酷时钟</h1>
			<h2 id="one"></h2>
			<h2 id="two"></h2>
		</div>
		<script>
			function time(){
				var now=new Date();
				var h=now.getHours();
				var m=now.getMinutes();
				var s=now.getSeconds();
				var years=now.getFullYear();
				var month=now.getMonth();
				var day=now.getDate();
				var xq=now.getDay();
				var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
				month=(month>10?month:"0"+month);
				day=(day>10?day:"0"+day);
				h=(h>10?h:"0"+h);
				m=(m>10?m:"0"+m);
				s=(s<10?"0"+s:s);
				one.innerHTML=years+"年"+month+"月"+day+"日";
				two.innerHTML=h+":"+m+":"+s+"  "+weekday[xq];
			}
			window.setInterval(time,1000);
			</script>
	</body>
</html>